#created by I. MArfin 01/10/2012

# file to be created : FILE.pdf
FILE=Hbb_PIC2012

# Main file having document[class]
MAIN=hbb_marfin_proceedings


# for temporary storage
TMPDIR = $$HOME/tmp/$(FILE)


ALL_FILES = Makefile \
	    $(TEX_SOURCES) \
	    $(FIGURES) \
	    $(BIBS) 



Dirs:=${shell find . -type d | grep -v ".svn" | grep  "./"}
TEX_SOURCES:=${shell  find .  -iname "*.tex" }
FIGURES:=${shell find .  -iname "*.eps" -o  -iname "*.png" -o  -iname "*.pdf" | grep -v $(FILE) }
BIBS:=${shell find .  -iname "*.bib" }
PYS:=${shell find .  -iname "*.py" }
  

all : $(FILE).pdf


$(FILE).pdf :$(TEX_SOURCES) \
          $(FIGURES) \
	  $(BIBS)
	pdflatex $(MAIN)
#	bibtex $(MAIN)
	pdflatex $(MAIN)
	pdflatex $(MAIN)
	mv $(MAIN).pdf $(FILE).pdf

spell:  
	for file in $(TEX_SOURCES); do \
	aspell -t -c $${file}; \
	done;

encrypt:
	for file in $(TEX_SOURCES) $(FIGURES) $(BIBS); do \
    gpg --passphrase-fd 3 --batch -c $${file} 3< ./passwd.txt; \
    done;

decrypt:
	for file in ${shell find .  -iname "*.gpg" }; do \
    gpg --passphrase-fd 3  --batch   $${file} 3< ./passwd.txt; \
    done;
	 

#add2SVN:
#svn add $(Dirs) $(TEX_SOURCES) $(FIGURES) $(BIBS)  $(PYS) Makefile
#svn ci $(Dirs) $(TEX_SOURCES) $(FIGURES) $(BIBS)  $(PYS) Makefile 

add2SVN:
	svn add $(Dirs) ${shell find .  -iname "*.gpg" }  ${shell find .  -iname "*.cls" }  Makefile
	svn ci $(Dirs)  ${shell find .  -iname "*.gpg" }  ${shell find .  -iname "*.cls" } Makefile 

checkOutSVN:
	svn co https://my-code-iggy-floyd-de.googlecode.com/svn/branches/$(FILE)


makeSVN:
	- mkdir -p $(TMPDIR)
	- mv $(TEX_SOURCES) $(FIGURES) $(BIBS)  $(TMPDIR)	 
	- svn mkdir  https://my-code-iggy-floyd-de.googlecode.com/svn/branches/$(FILE)

cleanGPG:
	- mkdir -p $(TMPDIR)
	- mv  ${shell find .  -iname "*.gpg" }  $(TMPDIR)

clean :
	- mkdir -p $(TMPDIR)
	- mv *.dvi *.log *.loc *.lof *.toc *.ps *.aux *.bbl *.blg  *.bak $(TMPDIR)
#	- mv *~ $(TMPDIR)










